/**  
 * All rights Reserved, Designed By <a href="www.itttq.com" target="_blank">www.itttq.com</a>
 * @date:   2017-07-21 11:42:21
 * @Copyright: 2017 <a href="www.itttq.com" target="_blank">www.itttq.com</a> Inc. All rights reserved. 
 */
package com.itttq.gshop.pbpm.mapper;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Lang;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.UpdateProvider;

import com.itttq.gshop.domain.po.OrderWarePo;
import com.itttq.gshop.pbpm.cmpt.mybatis.CustomInLanguage;
import com.itttq.gshop.pbpm.provider.OrderWareSqlProvider;

@Mapper
public interface IOrderWareMapper {
	/**
	 * 新增OrderWarePo对象
	 * 
	 * @param OrderWarePo
	 * @Author 迷蝶
	 * @return Integer
	 */
	@InsertProvider(type=OrderWareSqlProvider.class,  method="addOrderWare") 
	public Integer addOrderWare(OrderWarePo orderWare);

	/**
	 * 更新OrderWarePo对象
	 * 
	 * @param orderWarePo
	 * @Author 迷蝶
	 * @return Integer
	 */
	@UpdateProvider(type=OrderWareSqlProvider.class,  method="updateOrderWare") 
	public Integer updateOrderWare(OrderWarePo orderWare);
	
	/**
	 * 根据ID删除OrderWarePo对象
	 * 
	 * @param id
	 * @Author 迷蝶
	 * @return Integer
	 */
	@DeleteProvider(type=OrderWareSqlProvider.class,  method="delOrderWare") 
	public Integer delOrderWareById(Integer id);

	/**
	 * 根据IDS删除OrderWarePo对象
	 * 
	 * @param ids
	 * @Author 迷蝶
	 * @return List<OrderWarePo>
	 */
	@Lang(CustomInLanguage.class)
	@Delete("DELETE FROM order_ware WHERE id IN (#{ids})")
	public Integer delOrderWareByIds(@Param("ids") List<Integer> ids);
	
	/**
	 * 根据条件查找OrderWarePo对象，默认根据ID降序
	 * 
	 * @param orderWarePo
	 * @Author 迷蝶
	 * @return List<OrderWarePo>
	 */
	@SelectProvider(type=OrderWareSqlProvider.class,  method="findOrderWares") 
	public List<OrderWarePo> findOrderWares(OrderWarePo orderWare);
	
	/**
	 * 根据条件查找记录总数
	 * 
	 * @param orderWarePo
	 * @Author 迷蝶
	 * @return Integer
	 */
	@SelectProvider(type=OrderWareSqlProvider.class,  method="findOrderWareCount") 
	public Integer findOrderWareCount(OrderWarePo orderWare);

	/**
	 * 根据ID查找OrderWarePo对象
	 * 
	 * @param id
	 * @Author 迷蝶
	 * @return OrderWarePo
	 */
	@SelectProvider(type=OrderWareSqlProvider.class,  method="findOrderWareById") 
	public OrderWarePo findOrderWareById(Integer id);

	/**
	 * 根据订单ID查询此订单的所有商品信息
	 * 
	 * @param orderId	订单ID
	 * @Author 迷蝶
	 * @return List<OrderWarePo>
	 */
	@Select("SELECT * FROM order_ware WHERE order_id = #{orderId}")
	public List<OrderWarePo> findOrderWareByOrderId(@Param("orderId") Integer orderId);

	/**
	 * 批量增加订单商品信息
	 * 
	 * @param map	
	 * @Author 迷蝶
	 * @return String
	 */
	@InsertProvider(type=OrderWareSqlProvider.class,  method="insertBatch") 
	public Integer insertBatch(final Map<String, List<OrderWarePo>> map);
	
	/**
	 * 根据订单ID集合查询订单商品数据
	 * 
	 * @param orderIds	订单ID集合
	 * @Author 迷蝶
	 * @return List<OrderWarePo>
	 */
	@Lang(CustomInLanguage.class)
	@Select("SELECT * FROM order_ware WHERE order_id IN (#{orderIds})")
	public List<OrderWarePo> findOrderWareByOrderIds(@Param("orderIds") final List<Integer> orderIds);
}